package org.example.web_demo1.config;

import org.example.web_demo1.filters.CrosFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfig {

    @Bean
    public FilterRegistrationBean<CrosFilter> filterRegistrationBean() {
        FilterRegistrationBean<CrosFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new CrosFilter());
        registrationBean.addUrlPatterns("/*");
        registrationBean.setName("crosFilter");
        registrationBean.setOrder(1);
        return registrationBean;

    }
}
